fix(streaming): resolve panics, add pause guards, and delegate events - #642
Merged
Conversation
…ents FlowwStar#467 - Convert cleanup_stream() panics to Result return type - Replace .unwrap() panics in get_archived_sent/received_streams paginators with safe if-let guards - Add StreamCleanedUpEvent struct and emit it from cleanup_stream() - Add missing Ok(()) so the function compiles and returns correctly FlowwStar#468 - Add require_not_paused guard to update_stream_metadata() - Metadata could previously be mutated while the contract was paused; now matches the guard present on every other state-changing function - Add test_pause_blocks_update_stream_metadata to confirm enforcement FlowwStar#469 - Add pause guard and events to set_delegate() / remove_delegate() - Both functions now call require_not_paused(&env) at entry - Add DelegateSetEvent and DelegateRemovedEvent structs - Both functions now publish their respective events, matching the pattern of every other state-changing function in the contract Closes FlowwStar#467 Closes FlowwStar#468 Closes FlowwStar#469
|
@brightfootlimited-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary Fixes three related issues in contracts/streaming/src/lib.rs where public state-changing functions were inconsistent with the rest of the contract. --- ### Closes #467 — Convert \cleanup_stream()\ panics to \Result\ return type - Replaced .unwrap()\ panics in \get_archived_sent_streams\ and \get_archived_received_streams\ paginators with safe \if let\ guards - Added \StreamCleanedUpEvent\ struct following the existing event pattern - \cleanup_stream()\ now emits the event and returns \Ok(()), making it consistent with all sibling functions ### Closes #468 — Add \
equire_not_paused\ guard to \update_stream_metadata()\ - \update_stream_metadata()\ was the only state-changing function that allowed writes while the contract was paused - Added \Self::require_not_paused(&env)?\ at the top of the function - Added \ est_pause_blocks_update_stream_metadata\ to \ est_features.rs\ to confirm enforcement ### Closes #469 — Add pause guard and events to \set_delegate()\ /
emove_delegate()\ - Both functions now call
equire_not_paused(&env)\ at entry - Added \DelegateSetEvent\ and \DelegateRemovedEvent\ structs - Both functions now publish their respective events, matching the pattern of every other state-changing function in the contract --- ## Testing - Pre-commit hook (
ustfmt --check) passes cleanly - \ est_pause_blocks_update_stream_metadata\ added for #468 - Existing cleanup, delegate, and pause tests continue to pass